OTT    = ~/src/ott_distro_0.10.14/bin/ott

OTT_FLAGS := -tex_wrap false -signal_parse_errors true
OTT_FLAGS += -show_defns false -show_post_sort false

scalina = scalina-theory.ott
scalinagramm = scalina-simple-grammar.ott

.PHONY: manual clean

all : theory.tex theory_override.tex 
#grammar.tex

theory.tex : $(scalina)
	$(OTT) $(OTT_FLAGS) -tex_name_prefix scalina -tex $@ -merge true $(scalina)

grammar.tex : $(scalinagramm)
	$(OTT) $(OTT_FLAGS) -tex_name_prefix scalinagramm -tex $@ -merge true $(scalinagramm)

theorystdalone.tex : $(scalina)
	$(OTT) -tex_show_meta false -tex $@ -merge true $(scalina)
	
theorystdalone.pdf : theorystdalone.tex
	pdflatex -interaction=batchmode  theorystdalone.tex

%_override.tex: override.tex empty.ott
	$(OTT) $(OTT_FLAGS) -tex_name_prefix scalina -tex_filter $< $@ empty.ott

clean:
	@rm -f *~ *.{aux,bbl,blg,dvi,log,ps,pdf,sys,thy} \
               *_{included,override}.tex
